﻿using System.Buffers;
using System.Text.Json.Serialization;
using XC.DataAccess.EncoderDecoder;

namespace Xc.DataAccess.Protocoals.WaterMeters.Models
{
    public class MeterFrameRx
    {
        internal const byte StartConst = 0x68;
        internal const byte StopConst = 0x16;

        /// <summary>
        /// 起始位
        /// </summary>
       [JsonIgnore] 
        internal byte Start { get; set; } = StartConst;
        /// <summary>
        /// 表计类型
        /// </summary>
        public MeterType MeterType { get; set; }
        /// <summary>
        /// 表地址
        /// </summary>
        [JsonIgnore]
        internal byte[] MeterAddress { get; set; }
        /// <summary>
        /// 控制码
        /// </summary>
        public FrameCommand Cmd { get; set; }
        /// <summary>
        /// 数据包长度
        /// </summary>
        [JsonIgnore]
        internal byte Length { get; set; }
        /// <summary>
        /// 数据域
        /// </summary>
        [JsonIgnore]
        internal protected DataArea DataArea { get; set; }
        /// <summary>
        /// 完整包
        /// </summary>
        [JsonIgnore]
        internal byte[] FullFrame { get; set; }
        /// <summary>
        /// 校验码
        /// </summary>
        [JsonIgnore]
        internal byte Check { get; set; }
        /// <summary>
        /// 结束包
        /// </summary>
        [JsonIgnore]
        internal byte Stop { get; set; } = StopConst;
    }
}
